package edu.thu.studio.ormdesigner.model.diagram.link;

import java.util.List;

import edu.thu.studio.ormdesigner.model.ObjectSet;
import edu.thu.studio.ormdesigner.model.orm.table.Table;

public class LinkSet extends ObjectSet<Link> {
	private static final long serialVersionUID = 4679724122841299783L;

	public boolean hasLinked(Table source, Table target) {
		List<Link> links = this.getObjectList();
		for (Link link : links) {
			if (link.getSource().getRefTable().equals(source)
					&& link.getTarget().getRefTable().equals(target)) {
				return true;
			}
		}

		return false;
	}
}
